﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Wolfbyte.Core.UnitOfWork;
using Wolfbyte.Core;
using System.Data.Linq;
using System.Data.Linq.Mapping;

namespace Wolfbyte.UnitOfWork.LinqToSql
{
    public class LinqToSqlUnitOfWorkFactory : IFactory<IUnitOfWork>
    {
        private IFactory<DataContext> ContextFactory;

        public LinqToSqlUnitOfWorkFactory(IFactory<DataContext> ContextFactory)
        {
            this.ContextFactory = ContextFactory;
        }

        #region IFactory<IUnitOfWork> Members

        public IUnitOfWork Create()
        {
            var DataContext = ContextFactory.Create();
            return new LinqToSqlUnitOfWork(DataContext);
        }

        #endregion
    }
}
